package com.DeptManage.controller;

import com.DeptManage.entity.Student;
import com.DeptManage.service.StudentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class StudentController {

    @Autowired
    public StudentService studentService;

    @RequestMapping("/index")
    public ModelAndView index(){
        int n = studentService.getSum();
        List<Student> getMax=studentService.getMax();
        List<Student> getSax=studentService.getSax();

        return  new ModelAndView("index.jsp")
                .addObject("max",getMax)
                .addObject("sax",getSax)
                .addObject("n",n);
    }
}